<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'Invitation.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

<script type="text/javascript"
	src="${pageContext.request.contextPath }/js/jquery-1.8.3.min.js"></script>

</head>

<body>
	<table border="2">
		<tr>
			<th colspan="5">帖子列表</th>
		</tr>
		<tr>
			<th colspan="5"></th>
		</tr>
		<tr style="background-color: blue;">

			<th>标题</th>
			<th>内容摘要</th>
			<th>作者</th>
			<th>发布时间</th>
			<th>操作</th>
		</tr>
		<c:forEach var="invitathion" items="${invitationLsit}" varStatus="i">
			<tr
				<c:if test="${i.index%2==1} ">style="background-color: green;"</c:if>>
				<td>${invitathion.title }</td>
				<td>${invitathion.summary }</td>
				<td>${invitathion.author }</td>
				<td>${invitathion.createdate }</td>
				<td><a
					href="${pageContext.request.contextPath }/reply.html?invid=${invitathion.id}">回复</a>||
					<a
					href="javascript:deleteById('${pageContext.request.contextPath }',${invitathion.id});">删除</a>
				</td>
			</tr>
		</c:forEach>
	</table>
</body>
<script type="text/javascript">
	function deleteById(obj, id) {
		var falg = confirm("你是否要删除？？？");
		if (falg) {
			$.getJSON(obj + "/delIn/" + id, function(data) {
				if (data.delResult == "true") {
					alert("删除成功！");
					window.location.reload();
				} else {
					alert("删除失败！");
				}
			});
		}
	}
</script>
</html>
